﻿@model Cafeteria.Models.Venta.Venta.VentaBean

@{
    ViewBag.Title = "Registrar Venta";
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm("Create2", "Venta", FormMethod.Post, new { @class = "form" }))
{
    @Html.ValidationSummary(false)
    <fieldset>
        <div class = "widget" >
            <div class = "title"><h6>Registrar Venta</h6></div>

          <div class="formRow">
               <span>Sucursal</span>                             
                                                                                        
                <div class = "formRight" >                            @Html.HiddenFor(model => model.idSucursal)          
                    @Html.DisplayFor(model => model.nombresucursal)  @Html.HiddenFor(model => model.nombresucursal)
                </div>      
                <div class = "clear" ></div>
            </div>

          <div class="formRow">
               <span>Fecha Registro</span>                             
                
                <div class = "formRight" > 
                    @Html.DisplayFor(model => model.fecharegistro) @Html.HiddenFor(model => model.fecharegistro)
                </div>      
                <div class = "clear" ></div>
          </div>
          <div class="formRow">
               <span>Nombre persona</span>                             
                
                <div class = "formRight" > 
                    @Html.TextBoxFor(model => model.nombrepersona) 
                </div>      
                <div class = "clear" ></div>
          </div>
          <div class="formRow">
               <span>Dni Persona</span>                             
                
                <div class = "formRight" > 
                    @Html.TextBoxFor(model => model.dnipersona)
                </div>      
                <div class = "clear" ></div>
          </div>
        </div>
    </fieldset>
    for (int i = 0; i < Model.listaproductos.Count; i++)
    {
        @Html.HiddenFor(model => model.listaproductos[i].id)   
        @Html.HiddenFor(model => model.listaproductos[i].idTipo) 
        @Html.HiddenFor(model => model.listaproductos[i].cantidad)
        @Html.HiddenFor(model => model.listaproductos[i].nombre)  
        @Html.HiddenFor(model => model.listaproductos[i].nombreTipo) 
        @Html.HiddenFor(model => model.listaproductos[i].preciounit2)
    }
    
    <div class="wrapper">
    <div class="widget">
      <div class="title">
      <h6>Lista de Productos</h6>
      </div>
      <div class="dataTables_wrapper">
            
            <table cellpadding = "0" cellspacing = "0" width = "100%" class = "display dTable">
    <thead>
        <tr>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                nombre
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Tipo
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
            <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Cantidad disponible
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
             <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Precio Unitario
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
              <th class="ui-state-default" rowspan="1" colspan="1" style="width:209px;" >
                <div class="DataTables_sort_wrapper">
                Cantidad solicitada
                <span class="DataTables_sort_icon css_right ui-icon ui-icon-triangle-1-s"></span>
                </div>
             </th>
        </tr>
    </thead>

    <tbody>

    @for (int i = 0; i < Model.listaproductos.Count; i++)
    {
        
        <tr class="gradeA odd">
            <td class="sorting_1">@Html.DisplayFor(model => model.listaproductos[i].nombre)</td> 
            <td class="sorting_1">@Html.DisplayFor(model => model.listaproductos[i].nombreTipo)</td> 
            <td>@Html.DisplayFor(model => model.listaproductos[i].cantidad)</td>
            <td>@Html.DisplayFor(model => model.listaproductos[i].preciouniario)</td>
            <td>@Html.TextBoxFor(model => model.listaproductos[i].cantidadsolicitada)</td>
             
        </tr>
    }
    </tbody>
    </table>
    </div>
        
    </div>
</div>
    
    
    <p>
        <input type="submit" value="Registrar" class = "redB" />
        <a href="javascript:history.back()">Regresar</a> 
    </p>
}